Maximum Generic Method

Wintellect PowerCollections

Collapse imageExpand ImageCollapseAll imageExpandAll imageDropDown imageDropDownHover imageCopy imageCopyHover image
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Finds the maximum value in a collection. A supplied IComparer<T> is used to compare the items in the collection.

Namespace: Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax

C#
public static T Maximum<T>(
	IEnumerable<T> collection,
	IComparer<T> comparer
)
Visual Basic (Declaration)
Public Shared Function Maximum(Of T) ( _
	collection As IEnumerable(Of T), _
	comparer As IComparer(Of T) _
) As T
Visual C++
public:
generic<typename T>
static T Maximum (
	IEnumerable<T>^ collection, 
	IComparer<T>^ comparer
)

Parameters

collection
IEnumerable<(Of <T>)>
The collection to search.
comparer
IComparer<(Of <T>)>
The comparer instance used to compare items in the collection.

Return Value

The largest item in the collection.

Type Parameters

T
The type of items in the collection.

Exceptions

ExceptionCondition
System..::InvalidOperationExceptionThe collection is empty.
System..::ArgumentNullExceptioncollection or comparer is null.

See Also